import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.1

ApplicationWindow {
    visible: true
    width: 640
    height: 480
    minimumWidth: 400
    minimumHeight: 300
    title: "Example"
    Rectangle {
        width: 640
        height: 480
        Rectangle {
            id: fakeMenuBar
            height: 21
            width: parent.width
            gradient: Gradient{
                GradientStop{color: "#fff" ; position:0}
                GradientStop{color: "#eee" ; position:1}
            }
            Rectangle {
                color: "#777"
                height: 1 ; width: parent.width
                anchors.bottom: parent.bottom
            }
            Row {
                id: menuBar
                property bool isClick:false
                Repeater {
                    model: 4
                    Button {
                        text: "Menu " + index
                        height: 20
                        width: 100
                        style: ButtonStyle {
                            background: Rectangle { color: control.pressed ? "#ccc" : "transparent" }
                        }
                        onClicked:menuBar.isClick=true
                        onHoveredChanged:console.log("click")
//                            function(){
//                            menuBar.isClick=true
//                            console.log("click")
//                      }
                        menu: Menu {
                            id: presetMenu2
                            title:"File"
                            Instantiator {
                                model: 4
                                MenuItem {
                                    text: "Index" + index
                                }

                                onObjectAdded: presetMenu2.insertItem(index, object)
                                onObjectRemoved: presetMenu2.removeItem(object)
                            }
                        }
                    }
                }
            }
        }

    }
}
